package com.itheima.date8;

import java.time.Duration;
import java.time.LocalDateTime;
import java.time.Year;
import java.time.temporal.TemporalUnit;
import java.util.concurrent.TimeUnit;

import static java.time.temporal.ChronoUnit.*;

/*
Duration
细一点的时间间隔对象
 */
public class Demo10 {

    public static void main(String[] args) {
        LocalDateTime birthday = LocalDateTime.of(1991, 9, 23, 14, 20, 30);
        LocalDateTime now = LocalDateTime.now();
        Duration between = Duration.between(birthday, now);
        System.out.println(between);
        System.out.println(between.getSeconds());
        System.out.println(between.get(SECONDS));
        //System.out.println(between.get(YEARS));
        //System.out.println(between.get(MONTHS));
        //System.out.println(between.get(DAYS));
        //System.out.println(between.get(HOURS));
        System.out.println(between.get(NANOS));
        System.out.println(between.toDays());
        System.out.println(between.toHours());
        System.out.println(between.toMillis());
        System.out.println(between.toNanos());


    }
}
